Toast Notification Element

The Toast Notification Element allows a notification popup to be configured which will display a message at runtime when an event has finished or an action has been completed. The Toast Element can be linked to any event or action for which the JavaScript can be customised.

Once the JavaScript for an event or action has been accessed, the Toast Element can be linked to it by adding a single line of code:

 

NDLLibrary.showToast(form1.page1.ndltoast1.htmlId);

 

In the above syntax (and for the project you are configuring), form1 will be the name of the form within which the Toast Element appears; page1 is the name of the page on which the Toast Element has been placed; and ndltoast1 is the name of the Toast Element as it appears in the Properties pane. The htmlId is a fixed (non-variable) code element and won't need changing.

In the below example, the Toast Element code has been placed inside the JavaScript for a Submit button, and appears at the bottom of the function block just before the closing bracket:

 

function Page1_ndlsubmitbutton1_success(ndlParams)

{

ndlParams.requestParams = ""; //initialise the requestParams field

ndlParams.tablename = "Form1"; //name the table

NDLRuntime.prepareDatasource("ElementsTest","Form1"); //read the values from the elements into the current record

ndlParams.data = NDLDSElementsTest.form1.getCurrent(); //assign the current record to the ndlParams.data object

NDLDSElementsTest.updateDatasource(ndlParams); //call updateDatasource - the response is asynchronous

NDLLibrary.showToast(form1.page1.ndltoast1.htmlId);

}